<?php
/**
 * Created by: i@fedax.cn
 * Date: 2018/11/7 22:39
 * $author 帅帅吴
 */
namespace app\admin\controller;

use app\admin\model\Family as FamilyModel;
use app\admin\model\FamilyActivity;
use app\admin\model\FamilyMembers as FamilyMemberModel;
use app\admin\model\FamilyActivity as FamilyActivityModel;

use app\admin\model\GiftRecord;
use app\admin\model\Message as MessageModel;
use app\admin\model\Message;
use think\Db;
class Family extends Index
{
    /**
     * @return \think\response\Json
     * @author shuaishuai wu
     * @date 2018/11/7
     * @time 13:41
     * @title 渲染家族列表
     */
    public function index()
    {
        return view();
    }

    /**
     * @return \think\response\Json
     * @author shuaishuai wu
     * @date 2018/11/7
     * @time 13:42
     * @title 家族列表数据
     */
    public function indexData()
    {
        $familyModel = new FamilyModel();

        $data = $familyModel->getDataList();
        return json($data);
    }

    /**
     * @return $this
     * @author shuaishuai wu
     * @date 2018/11/7
     * @time 13:47
     * @title 渲染家族成员信息表
     */
    public function familyMemberInfo()
    {
        return $this->fetch('',[
            'family_id'=>input('family_id'),
            'user_id' => input('user_id')
        ]);
    }

    /**
     * @return $this
     * @author shuaishuai wu
     * @date 2018/11/7
     * @time 13:59
     * @title 家族成员信息表
     */
    public function familyMemberInfoData()
    {
        $familyMemberModel = new FamilyMemberModel();
        $data = $familyMemberModel->familyMemberInfoData();
        return json($data);
    }

    public function familyMemberDetail()
    {
        $familyMemberModel = new FamilyMemberModel();
        $data = $familyMemberModel->familyMemberDetail();
        return json($data);
    }

    /**
     * @return array|\think\response\Redirect
     * @user 帅帅 吴
     * @date 2018/11/8
     * @time 11:15
     * @title 解散家族
     */
    public function familyDismiss()
    {
        $familyModel = new FamilyModel();
        $res = $familyModel->familyDismiss();
        return $res;
    }

    /**
     * @return \think\response\View
     * @user shuaishuai wu
     * @date 2018/11/13
     * @time 22:58
     * @title 预审家族列表
     */
    public function checkFamilyListIndex()
    {
        return view();
    }

    /**
     * @return \think\response\Json
     * @user shuaishiuai wu
     * @date 2018/11/13
     * @time 23:00
     * @title 预审家族列表数据
     */
    public function checkFamilyListIndexData()
    {
        $familyActivityModel = new FamilyActivityModel();
        $data = $familyActivityModel->getDataList();
        return json($data);
    }

    //同意
    public function checkFamilyAgree()
    {
        $familyActivityModel = new FamilyActivityModel();
        $res = $familyActivityModel->checkFamilyAgree();
        return $res;
    }
    //复审
    public function checkFamilyReview()
    {
        $familyActivityModel = new FamilyActivityModel();
        $res = $familyActivityModel->checkFamilyReview();
        return $res;
    }
    //解散
    public function checkFamilyDismiss()
    {
        $familyActivityModel = new FamilyActivityModel();
        $res = $familyActivityModel->checkFamilyDismiss();
        return $res;
    }

    /**
     * @user 帅帅五
     * @date 2018/12/13
     * @time 16:51
     * @title 预审家族活跃度
     */
    public function familyActiveInfo()
    {
        $familyId = input('familyId');
        return view()->assign('familyId',$familyId);
    }

    /**
     * @return \think\response\Json
     * @date 2018/12/13
     * @time 17:35
     * @title 预审家族活跃度数据
     */
    public function familyActiveInfoData()
    {
        $giftRecord =  new GiftRecord();
        $data = $giftRecord->familyActiveInfoData();
        return json($data);
    }

    /**
     * @user 帅帅 无
     * @date 2018/12/13
     * @time 17:38
     * @title 预审家族礼物详情
     */
    public function FamilyActiveGiftInfo()
    {
        $giftRecord =  new GiftRecord();
        $data = $giftRecord->FamilyActiveGiftInfo();
        return view()->assign('data',$data);
    }

    /**
     * @user shuashuaiwu
     * @date 2018/12/13
     * @time 18:07
     * @title 预审家族活跃度小时数据
     */
    public function familyActiveHourInfo()
    {
        $giftRecord =  new GiftRecord();
        $data = $giftRecord->familyActiveHourInfo();
        return view()->assign('data',$data);
    }

    /**
     * @user shuaishuaiwu
     * @date 2018/12/13
     * @time 18:58
     * @title 计算预审家族的活跃度（自定义时间）
     */
    public function familyActiveCountInfo()
    {
        $giftRecord =  new GiftRecord();
        $data = $giftRecord->familyActiveCountInfo();
        return $data;
    }
}